<%@ page contentType="text/html;charset=utf-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<html>
	<head>
		<title>流程定义列表</title>
		<%@ include file="/commons/meta.jsp"%>
		<script language=javascript src="${ctx}/scripts/date/wpCalendar.js"></script>
		<script language="JavaScript" src="${ctx}/scripts/home/common.js"></script>
		<script type="text/javascript">
			/*增删改查以外的方法在下面添加，在按钮的onclick方法调用otherAction(method, actionPath)*/
			function otherAction(method, actionPath){
				var entityIds = document.getElementById("entityIds");
				var checkNum = document.getElementById("checkNum"); 
				var id = entityIds.value;
				if(id != ""){id = id.substring(0, id.length - 1);}
				
				//添加你的方法
				if(method == "startProcess"){
					if(id == "") {alert("请选择记录!");return false;}
					if(checkNum.value != "1") {alert("请只选择一条记录!");return false;}
					
					this.location=actionPath + "?method=startProcess&id=" + id;
				} else if (method == "listProcessInstance"){
					if(id == "") {alert("请选择记录!");return false;}
					if(checkNum.value != "1") {alert("请只选择一条记录!");return false;}
					
					this.location=actionPath + "?method=list&s_proDefId=" + id;
				} else if (method == "newPro"){
					var url = actionPath + "?method=create";
					window.open(url, "newPro", "fullscreen=yes, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no");
				} else if (method == "editPro"){
					if(id == "") {alert("请选择记录!");return false;}
					if(checkNum.value != "1") {alert("请只选择一条记录!");return false;}
					
					var url = actionPath + "?method=edit&id=" + id;
					window.open(url, "editPro", "fullscreen=yes, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no");
				}
			}
		</script>
	</head>
	<body>
		<!--统一信息中部右边开始-->
		<div class="listrt">
			<!--位置-->
			<div class="listat">
				您当前所在的位置:首页 > 流程管理
			</div>
			<!--搜索-->
			<div class="listsch">
				<ul>
					<li>
						<img src="${templateVo.styleImagePath}/mid1.gif" />
					</li>
					<li style="padding-left: 6px;">
						搜索
					</li>
					<li style="float: right;">
						<img src="${templateVo.styleImagePath}/mid3.gif" />
					</li>
					<li class="tag" style="float: right;">
						<img src="${templateVo.styleImagePath}/tag10.gif"
							onclick="dispSearchDiv(this)" />
						&nbsp;
					</li>
				</ul>
			</div>
			<div class="listbox">
				<ul>
					<li>
						<table width="98%" border="0" align="left" cellpadding="0"
							cellspacing="0" id="searchDiv">
							<html:form action="/ProcessDefinitionAction.do">
								<input type="hidden" name="method" value="list" />
								<html:hidden property="entityIds" />
								<html:hidden property="checkNum" />
								
								<tr>
									<td nowrap align="right">流程名称：</td>
									<td><html:text property="s_name"/></td>
									
									<td nowrap align="right">类型：</td>
									<td>
										<html:select property="s_type">
											<html:option value=""></html:option>
											<html:option value="0">工单派发流程</html:option>
											<html:option value="1">审批流程</html:option>
										</html:select>
									</td>
									<td nowrap>
									    <input type="submit" value="查询" class="input3">
									    <input type="button" value="清空" class="input3" onclick="refresh(this.form)">
									</td>
								</tr>

							</html:form>
						</table>
					</li>
				</ul>
			</div>
			<!-- 操作反馈信息 -->
			<%@ include file="/commons/messages.jsp" %>
			<!--列表-->
			<div class="myinfo myinfo3 tophei">
				<ul>
					<li class="tag">
						&nbsp;
						<img src="${templateVo.styleImagePath}/tag17.gif" />
						&nbsp;
					</li>
					<li>
						<b>流程定义列表</b>
					</li>
				</ul>
			</div>
			<div class="listtag">
				<table width="99%" border="0" cellspacing="0" cellpadding="0"
					align="center">
					<tr height="30">
						<td valign="bottom" align="left">
							<myTag:img name="PROCESSDEFINITION_NEW_BTN"
								styleClass="xj" value="新建" onClick="otherAction('newPro', '${ctx}/ProcessDefinitionAction.do')" />
							<myTag:img name="PROCESSDEFINITION_EDIT_BTN"
								styleClass="xj1" value="修改" onClick="otherAction('editPro', '${ctx}/ProcessDefinitionAction.do')" />
						</td>
						<td align="right">
							<myTag:link name="PROCESSDEFINITION_VIEW_BTN" onClick="Action('view', '${ctx}/ProcessDefinitionAction.do')"
								picPath="${templateVo.styleImagePath}/list6.gif" value="查看" />
							<myTag:link name="PROCESSDEFINITION_DEL_BTN" onClick="Action('del', '${ctx}/ProcessDefinitionAction.do')"
								picPath="${templateVo.styleImagePath}/list4.gif" value="删除" />
						
							<!-- 
							<myTag:link name="PROCESSDEFINITION_DEL_BTN" onClick="otherAction('startProcess', '${ctx}/ProcessDefinitionAction.do')" 
								picPath="${templateVo.styleImagePath}/list6.gif" value="启动流程" />
							 -->
							<myTag:link name="PROCESSDEFINITION_DEL_BTN" onClick="otherAction('listProcessInstance', '${ctx}/ProcessInstanceAction.do')" 
								picPath="${templateVo.styleImagePath}/list6.gif" value="流程实例" />
							 
						</td>
					</tr>
				</table>
			</div>
			<ec:table items="list" var="e" action="${ctx}/ProcessDefinitionAction.do?method=list"
				retrieveRowsCallback="limit">
				
				<ec:row>
					<ec:column property="id"
						title="<input type='checkbox'  name='checkedAllBox' onclick='checkedAll(this);'>"
						sortable="false" width="3%" viewsDenied="xls">
						<div align="center">
							<input type="checkbox" name="entityId" value="${e.id}"
								onclick="checkedBox(this)">
						</div>
					</ec:column>
					
					<ec:column property="name" title="流程名称"/>
					<ec:column property="remark" title="说明"/>
					<ec:column property="version" title="版本"/>
					<ec:column property="type" title="类型">
						<c:if test="${e.type==1}">
							审批流程
						</c:if>
						<c:if test="${e.type==0}">
							工单派发流程
						</c:if>
					</ec:column>
					<ec:column property="creatorName" title="创建人"/>
					<ec:column property="modifyDate" title="更新日期" cell="date" format="yyyy-MM-dd HH:mm:ss"/>

				</ec:row>
			</ec:table>
		</div>
	</body>
</html>
